package com.yang.factory.simplefactory;

import com.yang.beans.Circle;
import com.yang.beans.Shape;
import com.yang.beans.Square;

/**
 * 简单工厂模式
 *
 * @author yang
 * @version 0.1
 * @date 2019/4/12
 */
public class SimpleFactory {

    public static final String CIRCLE = "circle";
    public static final String SQUARE = "square";

    public Shape getShape(String shape) {

        switch (shape) {
            case CIRCLE:
                return new Circle();
            case SQUARE:
                return new Square();
            default:
                return new Circle();
        }
    }
}
